local assets = {
	Asset("ANIM", "anim/musha_portion_e.zip"),
	Asset("ATLAS", "images/inventoryimages/musha_portion_e.xml"),
	Asset("IMAGE", "images/inventoryimages/musha_portion_e.tex")
}

local function item_oneaten(inst, eater)
	if eater.components.musha_staminasleep then
		eater.components.musha_fatiguesleep:SetPercent(0)
		eater.components.musha_staminasleep:DoDelta(80)
	end
	if eater.components.musha_spellpower then
		eater.components.musha_spellpower:DoDelta(80)
	end
end

local function fn(Sim)
	local inst = CreateEntity()
	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
	inst.entity:AddNetwork()

	MakeInventoryPhysics(inst)

	inst.AnimState:SetBank("bulb")
	inst.AnimState:SetBuild("musha_portion_e")
	inst.AnimState:PlayAnimation("idle")

	inst.entity:SetPristine()
	if not TheWorld.ismastersim then
		return inst
	end

	inst:AddComponent("stackable")
	inst.components.stackable.maxsize = TUNING.STACK_SIZE_LARGEITEM

	inst:AddComponent("tradable")
	inst:AddComponent("edible")
	--inst.components.edible.foodtype = "VEGGIE"
	inst.components.edible.foodtype = FOODTYPE.VEGGIE

	inst.components.edible.sanityvalue = 1
	inst.components.edible.healthvalue = 45
	inst.components.edible.hungervalue = 45
	inst.components.edible:SetOnEatenFn(item_oneaten)
	inst.components.edible.temperaturedelta = TUNING.COLD_FOOD_BONUS_TEMP
	inst.components.edible.temperatureduration = TUNING.FOOD_TEMP_BRIEF

	inst.entity:AddLight()
	inst.Light:SetFalloff(0.6)
	inst.Light:SetIntensity(.5)
	inst.Light:SetRadius(0.25)
	inst.Light:SetColour(69 / 255, 131 / 255, 145 / 255)
	inst.Light:Enable(true)
	inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")

	inst:AddComponent("inspectable")

	inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "images/inventoryimages/musha_portion_e.xml"

	return inst
end

return Prefab("musha_portion_e", fn, assets)
